package com.example.gulimall.member.web;

import com.example.common.utils.R;
import com.example.gulimall.member.feign.OrderFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *
 * </p>
 *
 * @author zyred
 * @since v 0.1
 **/
@Slf4j
@Controller
public class MemberWebController {

    @Autowired private OrderFeignService orderFeignService;

    @GetMapping("memberOrder.html")
    public String memberOrderPage (@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
                                   Model model) {
        Map<String,Object> para = new HashMap<>();
        para.put("page", pageNum);
        R orders = orderFeignService.listWithItem(para);
        log.info("订单信息：{}", orders);
        model.addAttribute("orders", orders);
        return "memberList";
    }

}
